// import { createRouter, createWebHistory } from 'vue-router'
// import HomePage from '@/views/HomePage.vue'
// import ChatRoom from '@/views/ChatRoom.vue'
//
// const routes = [
//   { path: '/', component: HomePage },
//   { path: '/chat/:roomId', component: ChatRoom }
// ]
//
// const router = createRouter({
//   history: createWebHistory(),
//   routes
// })
//
// export default router

import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomePage.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
  },
  {
    path: '/chat/:roomId',
    name: 'chat',
    component: () => import('../views/ChatRoom.vue'),
    props: true,
  },
]

const router = createRouter({
  history: createWebHistory(),
  routes,
})

export default router
